﻿using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace MsgQueueTest.Data
{
    public class DataManager
    {
        private static readonly Database Database;

        static DataManager()
        {
            Database = DatabaseFactory.CreateDatabase();
        }

        public static DataTable ExecStringCommandDataSet(string command)
        {

            var dbCommand = Database.GetSqlStringCommand(command);

            using (var dataSet = Database.ExecuteDataSet(dbCommand))
            {
                if (dataSet != null && dataSet.Tables.Count > 0)
                {
                    return dataSet.Tables[0];
                }
                return null;
            }
        }

       
    }
}
